package com.pearadmin.hospital.service.impl;

import java.util.List;
import java.util.ArrayList;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.pearadmin.common.web.domain.request.PageDomain;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.pearadmin.hospital.mapper.HospitalDruginfoMapper;
import com.pearadmin.hospital.domain.HospitalDruginfo;
import com.pearadmin.hospital.service.IHospitalDruginfoService;

/**
 * 药品信息Service业务层处理
 * 
 * @author yuan
 * @date 2021-07-29
 */
@Service
public class HospitalDruginfoServiceImpl implements IHospitalDruginfoService 
{
    @Autowired
    private HospitalDruginfoMapper hospitalDruginfoMapper;

    /**
     * 查询药品信息
     * 
     * @param id 药品信息ID
     * @return 药品信息
     */
    @Override
    public HospitalDruginfo selectHospitalDruginfoById(Integer id)
    {
        return hospitalDruginfoMapper.selectHospitalDruginfoById(id);
    }

    /**
     * 查询药品信息列表
     * 
     * @param hospitalDruginfo 药品信息
     * @return 药品信息
     */
    @Override
    public List<HospitalDruginfo> selectHospitalDruginfoList(HospitalDruginfo hospitalDruginfo)
    {
        return hospitalDruginfoMapper.selectHospitalDruginfoList(hospitalDruginfo);
    }

    /**
     * 查询药品信息
     * @param hospitalDruginfo 药品信息
     * @param pageDomain
     * @return 药品信息 分页集合
     * */
    @Override
    public PageInfo<HospitalDruginfo> selectHospitalDruginfoPage(HospitalDruginfo hospitalDruginfo, PageDomain pageDomain)
    {
        PageHelper.startPage(pageDomain.getPage(),pageDomain.getLimit());
        List<HospitalDruginfo> data = hospitalDruginfoMapper.selectHospitalDruginfoList(hospitalDruginfo);
        return new PageInfo<>(data);
    }

    /**
     * 新增药品信息
     * 
     * @param hospitalDruginfo 药品信息
     * @return 结果
     */

    @Override
    public int insertHospitalDruginfo(HospitalDruginfo hospitalDruginfo)
    {
        return hospitalDruginfoMapper.insertHospitalDruginfo(hospitalDruginfo);
    }

    /**
     * 修改药品信息
     * 
     * @param hospitalDruginfo 药品信息
     * @return 结果
     */
    @Override
    public int updateHospitalDruginfo(HospitalDruginfo hospitalDruginfo)
    {
        return hospitalDruginfoMapper.updateHospitalDruginfo(hospitalDruginfo);
    }

    /**
     * 删除药品信息对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteHospitalDruginfoByIds(String[] ids)
    {
        return hospitalDruginfoMapper.deleteHospitalDruginfoByIds(ids);
    }

    /**
     * 删除药品信息信息
     * 
     * @param id 药品信息ID
     * @return 结果
     */
    @Override
    public int deleteHospitalDruginfoById(Integer id)
    {
        return hospitalDruginfoMapper.deleteHospitalDruginfoById(id);
    }
}
